-
Notifications
You must be signed in to change notification settings - Fork 25k
[scripts] Update generate-artifacts-executor script to account for optional output path
#54609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[scripts] Update generate-artifacts-executor script to account for optional output path
#54609
Conversation
…optional The argument for the output path was always optional. This wasn't reflected in types, however, so this was missed in two prior changes.
b64d3f9 to
397b02c
Compare
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this in D87456501. |
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. I left a few suggestions and a couple of questions.
...ages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js
Outdated
Show resolved
Hide resolved
...ages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js
Outdated
Show resolved
Hide resolved
...ages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js
Outdated
Show resolved
Hide resolved
...ages/react-native/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/index.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/index.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/index.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js
Outdated
Show resolved
Hide resolved
packages/react-native/scripts/codegen/generate-artifacts-executor/utils.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Riccardo Cipolleschi <[email protected]>
The main motivation here is to ensure that: - `RCT_SCRIPT_OUTPUT_DIR` always takes precedence, as it should already be the correct output path - `autolinking.json` is read correctly from altered `baseOutputPath`s - `codegenConfig` overrides are consistently taken into account This necessitates moving most logic into the `platforms` for-loop, as the `baseOutputPath` can be changed per-platform in `package.json:codegenConfig.outputDir[platform]`, but otherwise nothing else changes.
|
@cipolleschi: The main thing I was struggling with is that the To circumvent this, I went for the other approach, I originally deemed to invasive, which is to unify the |
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code make sense to me. I'm a bit concerned about the caching mechanism, but we will know if it produces issues.
|
@cipolleschi can you re-improt this one? |
|
@cortinico merged this pull request in 7163033. |
Summary:
The argument for the output path to this CLI has always been optional, but the types didn't reflect this, which caused a few regressions in recent changes (e.g. #53503)
There's several code paths where the
baseOutputPathcan be altered or derived in different ways, which wasn't respected in logic before the main codegen output block or ingenerateReactCodegenPodspec.When applied, this PR alters the
baseOutputPathlogic to use a default bycomputeBaseOutputPathextracted fromcomputeOutputPathand have an addedprocess.env.RCT_SCRIPT_OUTPUT_DIRoverride, which was previously only applied toreadReactNativeConfigThis should restore:
react-native codegenbeing run without an--outputPathargumentpackage.json:codegenConfig.outputDiroverrideResolves #54473
Changelog:
[GENERAL] [FIXED] - Ensure codegen CLI supports unspecified
--outputPathargument and respectscodegenConfig.outputDirconfigurationsTest Plan:
react-native codegeninrn-tester